package com.gewu.pm.bean;

import java.util.List;

/**
 * 打卡统计数据Bean
 */
public class ClockInStatisticsBean {
    
    private int lateCount;         // 迟到人数
    private int earlyLeaveCount;   // 早退人数
    private int absentCount;       // 旷工人数
    
    // 各状态的员工详细列表
    private List<EmployeeClockInBean> lateList;
    private List<EmployeeClockInBean> earlyLeaveList;
    private List<EmployeeClockInBean> absentList;

    public ClockInStatisticsBean() {}

    public ClockInStatisticsBean(int lateCount, int earlyLeaveCount, int absentCount) {
        this.lateCount = lateCount;
        this.earlyLeaveCount = earlyLeaveCount;
        this.absentCount = absentCount;
    }

    /**
     * 获取总人数（迟到+早退+旷工）
     */
    public int getTotalCount() {
        return lateCount + earlyLeaveCount + absentCount;
    }

    /**
     * 获取实到人数（迟到+早退）
     */
    public int getActualCount() {
        return lateCount + earlyLeaveCount;
    }

    /**
     * 获取实到率
     */
    public float getActualRate() {
        int total = getTotalCount();
        if (total == 0) return 0f;
        return (float) getActualCount() / total;
    }

    /**
     * 获取迟到比例（用于绘制圆形进度）
     */
    public float getLateRate() {
        int total = getTotalCount();
        if (total == 0) return 0f;
        return (float) lateCount / total;
    }

    /**
     * 获取早退比例（用于绘制圆形进度）
     */
    public float getEarlyLeaveRate() {
        int total = getTotalCount();
        if (total == 0) return 0f;
        return (float) earlyLeaveCount / total;
    }

    /**
     * 获取旷工比例（用于绘制圆形进度）
     */
    public float getAbsentRate() {
        int total = getTotalCount();
        if (total == 0) return 0f;
        return (float) absentCount / total;
    }


    // Getter and Setter methods


    public int getLateCount() {
        return lateCount;
    }

    public void setLateCount(int lateCount) {
        this.lateCount = lateCount;
    }

    public int getEarlyLeaveCount() {
        return earlyLeaveCount;
    }

    public void setEarlyLeaveCount(int earlyLeaveCount) {
        this.earlyLeaveCount = earlyLeaveCount;
    }

    public int getAbsentCount() {
        return absentCount;
    }

    public void setAbsentCount(int absentCount) {
        this.absentCount = absentCount;
    }


    public List<EmployeeClockInBean> getLateList() {
        return lateList;
    }

    public void setLateList(List<EmployeeClockInBean> lateList) {
        this.lateList = lateList;
    }

    public List<EmployeeClockInBean> getEarlyLeaveList() {
        return earlyLeaveList;
    }

    public void setEarlyLeaveList(List<EmployeeClockInBean> earlyLeaveList) {
        this.earlyLeaveList = earlyLeaveList;
    }

    public List<EmployeeClockInBean> getAbsentList() {
        return absentList;
    }

    public void setAbsentList(List<EmployeeClockInBean> absentList) {
        this.absentList = absentList;
    }


    /**
     * 员工打卡记录Bean
     */
    public static class EmployeeClockInBean {
        private String employeeId;
        private String employeeName;

        public EmployeeClockInBean() {}

        public EmployeeClockInBean(String employeeId, String employeeName) {
            this.employeeId = employeeId;
            this.employeeName = employeeName;
        }

        // Getter and Setter methods
        public String getEmployeeId() {
            return employeeId;
        }

        public void setEmployeeId(String employeeId) {
            this.employeeId = employeeId;
        }

        public String getEmployeeName() {
            return employeeName;
        }

        public void setEmployeeName(String employeeName) {
            this.employeeName = employeeName;
        }
    }

    /**
     * 打卡状态枚举
     */
    public enum ClockInStatus {
        LATE("迟到", "#65B5FF"),
        EARLY_LEAVE("早退", "#ACD2FF"),
        ABSENT("旷工", "#1D85ED");

        private final String statusName;
        private final String color;

        ClockInStatus(String statusName, String color) {
            this.statusName = statusName;
            this.color = color;
        }

        public String getStatusName() {
            return statusName;
        }

        public String getColor() {
            return color;
        }
    }
}
